﻿using Alos.Common;
using Alos.Entity;
using Alos.IService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;

namespace Alos.LanClass.Api
{
    /// <summary>
    /// 教室信息获取
    /// </summary>
    public class ClassInfoController : ApiController
    {
        IBasicClassInfoService BasicClassInfoService;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="_BasicClassInfoService"></param>
        public ClassInfoController(IBasicClassInfoService _BasicClassInfoService)
        {
            BasicClassInfoService = _BasicClassInfoService;
        }
        /// <summary>
        /// 获取当前老师的班级信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Route("api/classinfo/myclass")]
        public async Task<JsonRtn<List<dynamic>>> myclass()
        {
            var jsRtn = new JsonRtn<List<dynamic>>();
            jsRtn.data = await Task.Factory.StartNew(uid =>
            {
                return BasicClassInfoService.GetBasicClassInfoByUid((int)uid).ToList();
            }, Common.Current.User.id);
            return jsRtn;
        }
    }
}